import 'package:getx_scaffold_ohos/getx_scaffold_ohos.dart';

/// 自动保持活动状态
mixin AutoKeepAliveMixin<T extends StatefulWidget> on State<T>{
  bool _keepAlive = true;

  @override
  bool get wantKeepAlive => _keepAlive;

  void toggleKeepAlive(bool value) {
    if (_keepAlive != value) {
      _keepAlive = value;
      if (mounted) setState(() {});
    }
  }
}
